package practice3;

class Rename {
    private final Rename1 rename1 = new Rename1(this);
    private double realpart;
    private double imagepart;

    public Rename(double Realpart, double Imagepart) {
        setRealpart(Realpart);
        setImagepart(Imagepart);
    }

    public double getImagepart() {
        return getRename1().getImagepart();
    }


    public double getRealpart() {
        return getRename1().getRealpart();
    }



    @Override
    public String toString() {
        return getRename1().toString();
    }

    public Rename addComplex(Rename a) {
        return getRename1().addComplex(a);
    }

    public Rename subComplex(Rename a) {
        return new Rename(getRename1().getRealpart() - a.getRealpart(), getRename1().getImagepart() - a.getImagepart());
    }

    public Rename mulComplex(Rename a) {
        return getRename1().mulComplex(a);
    }

    public Rename divComplex(Rename a) {
        return new Rename((getRename1().getRealpart() * a.getRealpart() + getRename1().getImagepart() * a.getImagepart()) / (Math.pow(a.getRealpart(), 2) + Math.pow(a.getImagepart(), 2)), (getRename1().getImagepart() * a.getRealpart() - getRename1().getRealpart() * a.getImagepart()) / (Math.pow(a.getRealpart(), 2) + Math.pow(a.getImagepart(), 2)));
    }

    protected Rename1 getRename1() {
        return rename1;
    }

    protected void setRealpart(double realpart) {
        this.realpart = realpart;
    }

    protected void setImagepart(double imagepart) {
        this.imagepart = imagepart;
    }
}
